<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      width: 100%;
      /* width: 500px; */
      height: 300px;
       background-color: #ccc;
       display: flex;
    }
    /* 子类的flex属性其实有三个，默认flex:flex: 0 1 auto
    flex-grow 
flex-shrink -- 
flex-basis */
/* flex-grow */

/*flex-shrink  默认1，用于决定项目在空间不足时是否缩小，
默认项目都是1，即空间不足时大家一起等比缩小；
注意，即便设置了固定宽度，也会缩小。但如果某个项目flex-shrink设置为0，则即便空间不够，自身也不缩小。 */
    .d1 {
      flex-grow: 0;
      background-color: red;
      flex-shrink: 0;

    }
    .d2 {
      /* 左右flex-shrink=0,中间1则父亲空间不够时，中间会跟着缩小 */
      flex-grow: 1; 
      width: 1000px;
      flex-shrink: 1;
      background-color: yellow;

    }
    .d3 {
      flex-shrink: 0;
      flex-grow: 0;
      background-color: blue;
  
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="d1">1</div>
    <div class="d2">2</div>
    <div class="d3">3</div>
  </div>

</body>
</html>